
import axios from 'axios';

/**
 * 订单材料关系
 */
export class OrderMaterialRelationService {
    // 分页查询列表
    static findOrderMaterialRelations (queryParams) {
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/findOrderMaterialRelations',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的订单材料关系
    static findOrderMaterialRelation (orderMaterialRelationId) {
        const query = {
            orderMaterialRelationId
        }
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/findOrderMaterialRelation',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的订单材料关系(包含外键名称)
    static findOrderMaterialRelationForView (orderMaterialRelationId) {
        const query = {
            orderMaterialRelationId
        }
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/findOrderMaterialRelationForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的订单材料关系(包含外键名称)
    static findOrderMaterialRelationForEdit (orderMaterialRelationId) {
        const query = {
            orderMaterialRelationId
        }
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/findOrderMaterialRelationForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的订单材料关系(只提取ID 和 Name)
    static findOrderMaterialRelationsWithIdNameById (orderMaterialRelationId) {
        const query = {
            orderMaterialRelationId
        }
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/findOrderMaterialRelationsWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询订单材料关系集合(只提取ID 和 Name)
    static findOrderMaterialRelationsWithIdNameByName (orderMaterialRelationName) {
        const query = {
            orderMaterialRelationName
        }
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/findOrderMaterialRelationsWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存订单材料关系
    static saveOrderMaterialRelation (orderMaterialRelation) {
        const query = {}
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/saveOrderMaterialRelation',
            method: 'POST',
            params: query,
            data: orderMaterialRelation
        });
    }

    //修改保存订单材料关系
    static updateOrderMaterialRelation (orderMaterialRelation) {
        const query = {}
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/updateOrderMaterialRelation',
            method: 'POST',
            params: query,
            data: orderMaterialRelation
        });
    }

    //修改保存订单材料关系状态
    static updateOrderMaterialRelationStatus (orderMaterialRelations) {
        const query = {}
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/updateOrderMaterialRelationStatus',
            method: 'POST',
            params: query,
            data: orderMaterialRelations
        });
    }

    //根据ID查询指定的订单材料关系(只提取ID 和 Name)
    static deleteOrderMaterialRelation (orderMaterialRelationId) {
        const query = {
            orderMaterialRelationId
        }
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/deleteOrderMaterialRelation',
            method: 'POST',
            params: query,
        });
    }

    //根据ID进行退货
    static returnOrderMaterial (orderMaterialRelationId) {
        const query = {
            orderMaterialRelationId
        }
        return axios({
            url: '/restaurant/material/OrderMaterialRelation/returnOrderMaterial',
            method: 'POST',
            params: query,
        });
    }
}
